import React, { Component } from "react";

export default class App extends Component {
  render() {
    const myInput = React.createRef();
    return (
      <div>
        <input type="text" ref={myInput} />
        <button
          onClick={() => {
            console.log(myInput.current.value);
            myInput.current.value = "";
          }}
        >
          点击获取
        </button>
      </div>
    );
  }
}
